package com.sihai.ehr.model.biz;

import com.sihai.core.BaseEntity;
import com.sihai.ehr.model.sys.Sex;
import org.apache.commons.httpclient.util.DateUtil;
import org.apache.commons.lang.xwork.StringUtils;

import javax.persistence.*;
import java.io.Serializable;
import java.sql.Blob;
import java.util.Date;

/**
 * author:zj
 * 员工基本信息类
 */
@Entity
@org.hibernate.annotations.Entity(dynamicUpdate = true)
public class EmployeeinfoBase extends BaseEntity<Long> {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;  //员工编号
    private String name;    //员工姓名
    private String facePath;//头像路径
    private String sex; //性别
    private String tel;//联系电话
    private String handSet;//手机
    private String address;//地址
    private String postcode;//邮编
    private String idcard;//身份证
    @Temporal(value = TemporalType.DATE)
    private Date birthday;//生日
    private String folk;//民族
    private String census;//户籍地址
    private String archives;//档案所在地
    private String stature;//身高
    private String avoirdupois;//体重
    private String eyeLeft;//左眼视力
    private String eyeRight;//右眼视力
    private String email;//邮箱
    private String marry;//是否结婚
    private String baby;//是否有小孩
    private String compensation;//入职期望薪资
    private String certificate;//学历
    private String tech;//技能熟练度
    private String entryDate;//入职日期
    private String school;//最高毕业学校
    private String englishRead;//英语读能力
    private String englishWrite;//英语写能力；
    private String englishDialog;//英语说能力
    private String englishLetter;//英语证书
    private String languageRead;
    private String languageWrite;
    private String languageDialog;   //1-一般，2-熟练，3-精通
    private String languageLetter;//其它语言证书
    private String remark;//备注
    private String state;//状态，使用状态1-在职员工，2-离职员工，3-人才库
    private String cancel;//1-删除，0-使用
    private Integer workAge; //工作年限
    private String suggestDuty;//建议岗位

    /*2013.01.18-add.wxn*/
    private String salaryNo; //员工的考勤工号(此工号在在职员工中不可以重复，但员工离职后可以再次使用)

    public EmployeeinfoBase() {
    }

    public EmployeeinfoBase(String name) {
        this.name = name;
    }

    public EmployeeinfoBase(Long id, String name) {
        this.id = id;
        this.name = name;
    }

    //for import data
    public EmployeeinfoBase(String name, String sex, String tel, String handSet, String address, String postcode, String idcard, Date birthday, String folk, String census, String archives, String stature, String avoirdupois, String eyeLeft, String eyeRight, String email, String marry, String baby, String compensation, String certificate, String tech, String entryDate, String school, String englishRead, String englishWrite, String englishDialog, String englishLetter, String languageRead, String languageWrite, String languageDialog, String languageLetter, String remark, String state, Integer workAge, String suggestDuty) {
        this.name = name;
        this.sex = sex;
        this.tel = tel;
        this.handSet = handSet;
        this.address = address;
        this.postcode = postcode;
        this.idcard = idcard;
        this.birthday = birthday;
        this.folk = folk;
        this.census = census;
        this.archives = archives;
        this.stature = stature;
        this.avoirdupois = avoirdupois;
        this.eyeLeft = eyeLeft;
        this.eyeRight = eyeRight;
        this.email = email;
        this.marry = marry;
        this.baby = baby;
        this.compensation = compensation;
        this.certificate = certificate;
        this.tech = tech;
        this.entryDate = entryDate;
        this.school = school;
        this.englishRead = englishRead;
        this.englishWrite = englishWrite;
        this.englishDialog = englishDialog;
        this.englishLetter = englishLetter;
        this.languageRead = languageRead;
        this.languageWrite = languageWrite;
        this.languageDialog = languageDialog;
        this.languageLetter = languageLetter;
        this.remark = remark;
        this.state = state;
        this.workAge = workAge;
        this.suggestDuty = suggestDuty;
    }

    @Override
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getTech() {
        return tech;
    }

    public void setTech(String tech) {
        this.tech = tech;
    }

    public String getEntryDate() {
        return entryDate;
    }

    public void setEntryDate(String entryDate) {
        this.entryDate = entryDate;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getFacePath() {
        return facePath;
    }

    public void setFacePath(String facePath) {
        this.facePath = facePath;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getTel() {
        return tel;
    }

    public void setTel(String tel) {
        this.tel = tel;
    }

    public String getHandSet() {
        return handSet;
    }

    public void setHandSet(String handSet) {
        this.handSet = handSet;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getPostcode() {
        return postcode;
    }

    public void setPostcode(String postcode) {
        this.postcode = postcode;
    }

    public String getIdcard() {
        return idcard;
    }

    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    public String getFolk() {
        return folk;
    }

    public void setFolk(String folk) {
        this.folk = folk;
    }

    public String getCensus() {
        return census;
    }

    public void setCensus(String census) {
        this.census = census;
    }

    public String getArchives() {
        return archives;
    }

    public void setArchives(String archives) {
        this.archives = archives;
    }

    public String getStature() {
        return stature;
    }

    public void setStature(String stature) {
        this.stature = stature;
    }

    public String getAvoirdupois() {
        return avoirdupois;
    }

    public void setAvoirdupois(String avoirdupois) {
        this.avoirdupois = avoirdupois;
    }

    public String getEyeLeft() {
        return eyeLeft;
    }

    public void setEyeLeft(String eyeLeft) {
        this.eyeLeft = eyeLeft;
    }

    public String getEyeRight() {
        return eyeRight;
    }

    public void setEyeRight(String eyeRight) {
        this.eyeRight = eyeRight;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getMarry() {
        return marry;
    }

    public void setMarry(String marry) {
        this.marry = marry;
    }

    public String getBaby() {
        return baby;
    }

    public void setBaby(String baby) {
        this.baby = baby;
    }

    public String getCompensation() {
        return compensation;
    }

    public void setCompensation(String compensation) {
        this.compensation = compensation;
    }

    public String getCertificate() {
        return certificate;
    }

    public void setCertificate(String certificate) {
        this.certificate = certificate;
    }

    public String getSchool() {
        return school;
    }

    public void setSchool(String school) {
        this.school = school;
    }

    public String getEnglishRead() {
        return englishRead;
    }

    public void setEnglishRead(String englishRead) {
        this.englishRead = englishRead;
    }

    public String getEnglishWrite() {
        return englishWrite;
    }

    public void setEnglishWrite(String englishWrite) {
        this.englishWrite = englishWrite;
    }

    public String getEnglishDialog() {
        return englishDialog;
    }

    public void setEnglishDialog(String englishDialog) {
        this.englishDialog = englishDialog;
    }

    public String getEnglishLetter() {
        return englishLetter;
    }

    public void setEnglishLetter(String englishLetter) {
        this.englishLetter = englishLetter;
    }

    public String getLanguageRead() {
        return languageRead;
    }

    public void setLanguageRead(String languageRead) {
        this.languageRead = languageRead;
    }

    public String getLanguageWrite() {
        return languageWrite;
    }

    public void setLanguageWrite(String languageWrite) {
        this.languageWrite = languageWrite;
    }

    public String getLanguageDialog() {
        return languageDialog;
    }

    public void setLanguageDialog(String languageDialog) {
        this.languageDialog = languageDialog;
    }

    public String getLanguageLetter() {
        return languageLetter;
    }

    public void setLanguageLetter(String languageLetter) {
        this.languageLetter = languageLetter;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public String getCancel() {
        return cancel;
    }

    public void setCancel(String cancel) {
        this.cancel = cancel;
    }

    public Integer getWorkAge() {
        return workAge;
    }

    public void setWorkAge(Integer workAge) {
        this.workAge = workAge;
    }

    public String getSuggestDuty() {
        return suggestDuty;
    }

    public void setSuggestDuty(String suggestDuty) {
        this.suggestDuty = suggestDuty;
    }

    public String getSalaryNo() {
        return salaryNo;
    }

    public void setSalaryNo(String salaryNo) {
        this.salaryNo = salaryNo;
    }

    public String getDisplaySex(){
        if(StringUtils.equals(sex, "0")){
            return "男";
        }else if(StringUtils.equals(sex, "1")){
            return "女";
        }
        return "未知";
    }
    public String getDisplayMarry(){
        if(StringUtils.equals(marry, "0")){
            return "未婚";
        }else if(StringUtils.equals(marry, "1")){
            return "已婚";
        }
        return "未知";
    }
    public String getDisplayCertificate(){
        if(StringUtils.equals(certificate, "1")){
            return "小学";
        }else if(StringUtils.equals(certificate, "2")){
            return "初中";
        }else if(StringUtils.equals(certificate, "3")){
            return "高中";
        }else if(StringUtils.equals(certificate, "4")){
            return "大专";
        }else if(StringUtils.equals(certificate, "5")){
            return "本科";
        }else if(StringUtils.equals(certificate, "6")){
            return "硕士";
        }else if(StringUtils.equals(certificate, "7")){
            return "博士";
        }else if(StringUtils.equals(certificate, "8")){
            return "博士后";
        }
        return "未知";
    }
    public String getDisplayBirthday(){
        if(birthday == null){
            return "";
        }
        return DateUtil.formatDate(birthday, "yyyy-MM-dd");
    }
}
